package cn.didi.feidi.javabackend.server.user.service;

import cn.didi.feidi.javabackend.mysql.jpa.entity.Userxx;
import cn.didi.feidi.javabackend.mysql.jpa.exception.MyException;
import cn.didi.feidi.javabackend.mysql.jpa.user.User;
import cn.didi.feidi.javabackend.server.user.epository.UserRep;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/7/12.
 */
@Service
@ComponentScan(basePackages = {"cn.didi.feidi.javabackend.server.user"})
public class UserService {
    @Autowired
    UserRep userRep;

    public User getUserById(String id){
        User user = userRep.getUserById(id);
        return user;
    }

    public void addUser(User user){
        userRep.addUser(user);
    }

    public void deleteUserById(String id){
        userRep.deleteUserById(id);
    }

    public void updateUser(User user){
        userRep.updateUser(user);
    }

    public List<User> getUsersByName(String name){
        return userRep.getUsersByName(name);
    }

    public void updateUserById(String id, Map<String, Object> params){
        userRep.updateUserById(id, params);
    }
}
